package com.yugao.fintech.antelope.member.service;

import com.yugao.fintech.antelope.member.model.mq.MemberRegisterMQ;
import com.yugao.fintech.antelope.member.model.mq.MemberUserDeleteMQ;
import com.yugao.fintech.antelope.member.model.mq.MemberUserLevelUpgradeMQ;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;


@Service
public class MemberMqServiceImpl implements MemberMqService {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void send(MemberRegisterMQ req) {
        rabbitTemplate.convertAndSend(MemberRegisterMQ.EXCHANGE, MemberRegisterMQ.KEY, req.toMessage());
    }

    @Override
    public void send(MemberUserLevelUpgradeMQ req) {
        rabbitTemplate.convertAndSend(MemberRegisterMQ.EXCHANGE, MemberUserLevelUpgradeMQ.KEY, req.toMessage());
    }

    @Override
    public void send(MemberUserDeleteMQ req) {
        rabbitTemplate.convertAndSend(MemberRegisterMQ.EXCHANGE, MemberUserDeleteMQ.KEY, req.toMessage());
    }
}
